import "LotroLCD.LotroLCD.UI";

LotroLCDStatsWindow = class(LotroLCDElementWindow);
function LotroLCDStatsWindow:Constructor(parent, settings, plugin)
	Turbine.UI.Lotro.Window.Constructor(self);
	
	-- Make a list of available elements for this window
	self.availableElements = plugin.settings.availableElements;
	
	-- Keep track of parent and base plugin object
	self.parent = parent;
	self.plugin = plugin;
	
	-- Associate settings
	self.settings = settings;
	
	-- Create a placeholder to use when window is minimized
	self.placeholder = LotroLCDPlaceholderWindow(self, self.settings, plugin);
	
	-- Set Look, feel, size  and position
	self:SetBackColorBlendMode(Turbine.UI.BlendMode.Normal);
	self:SetOpacity(settings.opacity);
	self:SetText(settings.windowTitle);
	self:SetPosition(settings.x, settings.y);
	self:SetSize(165, 100);
	self:SetVisible(settings.visibility);
	
	-- Create Config Window and Button
	self.configWindow = LotroLCDConfigWindow(self, {windowType = "LotroLCDConfigWindow", x = settings.x, y = settings.y, opacity = settings.opacity, visibility = false}, plugin);
	self:ConstructConfigButton(self, self.configWindow);
	
	-- Listbox to automatically layout multiple widgets as a group, keys
	self.keyListbox = Turbine.UI.ListBox();
	self.keyListbox:SetParent(self);
	self.keyListbox:SetPosition(30, 50);
	self.keyListbox:SetSize(60, 20);
	
	-- Get a sorted array of enabled elements
	self.enabledElements = dictOfKeyPositionToSortedArray(settings.elements);
	
	-- Add label/button to stats window for each enabled data element
	self:RefreshListbox(self.enabledElements, self.keyListbox);
	
	-- Listbox to automatically layout multiple widgets as a group, values
	self.valueListbox = Turbine.UI.ListBox();
	self.valueListbox:SetParent(self);
	self.valueListbox:SetPosition(90, 50);
	self.valueListbox:SetSize(40, 20);
	
	-- Add label/button to stats window for each enabled data element
	self:RefreshListbox(plugin:GetElementValues(self.enabledElements),self.valueListbox);
end
